# -*- coding: utf-8 -*-

import random


def genImeiLuhn(digits14):
    digit15 = 0
    for num in range(14):
        if num % 2 == 0:
            digit15 = digit15+int(digits14[num])
        else:
            digit15 = digit15 + (int(digits14[num]) * 2) % 10 + int((int(digits14[num]) * 2) / 10)
    digit15 = int(digit15) % 10
    if digit15 == 0:
        digits14 = digits14+str(digit15)
    else:
        digits14 = digits14+str(10-digit15)
    return digits14


def genMassImei(stat14digits, amount):
    list = []
    ran = random.randint(0, amount - 1)
    for num in range(amount):
        imei = genImeiLuhn(stat14digits)
        stat14digits = str(int(stat14digits) + 1)
        list.append(imei)
    imei = list[ran]
    print(imei)
    return imei


if __name__ == '__main__':
    genMassImei("12345678901234", 1000)